﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zoo.Cat.Application.Security;
using Zoo.Cat.Domain.Entities.Jobseekers;

namespace Zoo.Cat.Application.Jobseekers {
    public class JobseekerRegistrationService : IJobseekerRegistrationService {
        #region Fields
        private readonly IJobseekerService _jobseekerService;
        private readonly IEncryptionService _encryptionService;
        #endregion

        public JobseekerRegistrationService(IJobseekerService jobseekerService,
            IEncryptionService encryptionService) {
                _jobseekerService = jobseekerService;
                _encryptionService = encryptionService;
           
        }
        public bool ValidateUser(string email, string password) {
            Jobseeker user = null;

            user = _jobseekerService.GetJobseekerByEmail(email);

            string pwd = "";
             //pwd = _encryptionService.CreatePasswordHash(password, user.PasswordSalt);

            bool isValid = pwd == user.Password;

            ////save last login date
            //if (isValid) {
            //    user.LastSignedIn = DateTime.Now;

            //}

            return isValid;

          
        }
    }
}
